<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增课程套餐')" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-meal-add">
            <div class="form-group" th:if="${#strings.isEmpty(courseId)}">
                <label class="col-sm-3 control-label is-required">所属课程:</label>
                <div class="col-sm-8">
<!--                    <input name="courseId" class="form-control" type="text" required>-->
                    <select name="courseId" class="form-control m-b" th:with="course=${courseList}">
                        <option value="">请选择</option>
                        <option th:each="item : ${course}" th:text="${item.courseName} + '-' +${item.courseType}" th:value="${item.id}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group" th:if="${not #strings.isEmpty(courseId)}">
                <input type="hidden" name="courseId" th:value="${courseId}">
                <label class="col-sm-3 control-label is-required">所属课程:</label>
                <div class="col-sm-8">
                    <input name="courseName" class="form-control" type="text" th:value="${courseName}" disabled required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">套餐名称:</label>
                <div class="col-sm-8">
                    <input name="mealName" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">课时:</label>
                <div class="col-sm-8">
                    <input name="courseHourse" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">赠送课时:</label>
                <div class="col-sm-8">
                    <input name="giveCourseHours" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">原价:</label>
                <div class="col-sm-8">
                    <input name="originalPrice" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">优惠方式:</label>
                <div class="col-sm-8">
                    <select name="discountType" class="form-control m-b" th:with="type=${@dict.getType('discount_type')}">
                        <option value="">所有</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">优惠值:</label>
                <div class="col-sm-8">
                    <input name="discountValue" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">备注:</label>
                <div class="col-sm-8">
                    <input name="remark" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "edu/meal"
        $("#form-meal-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-meal-add').serialize());
            }
        }
    </script>
</body>
</html>